package com.sren.boot.advice;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 * @author: renshuai
 * @date: 2019/11/22 下午3:27
 * @Description:
 */
@RestControllerAdvice
public class MyControllerAdvice {


	@ExceptionHandler(Exception.class)
	public Object handlerControllerException(HttpServletRequest request, Throwable throwable) {
		Map map = new HashMap();
		map.put("code", "400");
		map.put("message", throwable.getMessage());
		return map;
	}
}
